package com.zllkj.mm.module.home.fragments;

import android.view.View;
import android.view.WindowManager;
import android.widget.TextView;

import com.zllkj.mm.R;
import com.zllkj.mm.api.network.RetrofitHelper;
import com.zllkj.mm.api.network.RxHelper;
import com.zllkj.mm.api.network.subscriber.BaseString;
import com.zllkj.mm.api.network.subscriber.ProgressSubscriber;
import com.zllkj.mm.base.BaseTitleFragment;
import com.zllkj.mm.common.L;
import com.zllkj.mm.model.entity.SelfShopInfoS;

import java.util.HashMap;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 店铺详情
 * Created by leon_ok.
 */

public class ShopDetailFragment extends BaseTitleFragment {
    @BindView(R.id.shopStatusTv)
    TextView shopStatusTv;
    @BindView(R.id.shopNameTv)
    TextView shopNameTv;
    @BindView(R.id.shopIDTv)
    TextView shopIDTv;
    @BindView(R.id.businessGoodsTv)
    TextView businessGoodsTv;
    @BindView(R.id.bossNameTv)
    TextView bossNameTv;
    @BindView(R.id.phoneTv)
    TextView phoneTv;
    @BindView(R.id.shopAddTv)
    TextView shopAddTv;

    public static ShopDetailFragment newInstance() {
        return new ShopDetailFragment();
    }

    @Override
    protected int getContentLayoutId() {
        return R.layout.fragment_shopdetail;
    }

    @Override
    protected void initView(View rootView) {


        super.initView(rootView);
        setCommonTitle("店铺详情");
        addSubscribe(RetrofitHelper.getInstance().getApi()
                        .shopSelfInfo(L.sign(new HashMap() {{

                        }}))
                        .compose(RxHelper.<SelfShopInfoS>defaultHandleResult())
                        .subscribe(new ProgressSubscriber<SelfShopInfoS>(getContext()) {
                            @Override
                            protected void onSucc(SelfShopInfoS o) {
                          if(o.shopStatus==1){
                              shopStatusTv.setText("正常营业");
                          }else {
                              shopStatusTv.setText("封禁中");
                          }
                          shopNameTv.setText(o.shopName);
                          shopIDTv.setText(o.shopNo);
                          businessGoodsTv.setText(o.businessScope);
                          bossNameTv.setText(o.shopkeeperName);
                          phoneTv.setText(o.shopPhone);
                          shopAddTv.setText(o.addressInfo);
                            }
                        })
        );
    }


}

